/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package mum.edu.cs.waa.assignment.controller;

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import mum.edu.cs.waa.assignment.model.Database;

/**
 *
 * @author teke
 */
public class post extends HttpServlet {

    
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String btn = request.getParameter("btn");
        String page = "";
        if (btn.equalsIgnoreCase("Back")) {
            page = "index.jsp";
        } else {
            page = "newpost.jsp";
        }
         Database db = (Database) getServletContext().getAttribute("Database");
         
        //System.out.println(db.getPosts().get(0).getAccount().getName());
        RequestDispatcher topost = request.getRequestDispatcher(page);
        topost.forward(request, response);
    }
}
